Skip to content

Propagate onboarding telemetry blob through broker success and failure paths, Fixes AB#3462876#3123

Merged
wzhipan merged 8 commits into
devfrom
zhipan/onboarding-telemetry-failure-extract
May 22, 2026
Merged

Propagate onboarding telemetry blob through broker success and failure paths, Fixes AB#3462876#3123
wzhipan merged 8 commits into
devfrom
zhipan/onboarding-telemetry-failure-extract

Conversation

@wzhipan

@wzhipan wzhipan commented May 18, 2026

Copy link
Copy Markdown
Contributor

Makes MsalBrokerResultAdapter carry the onboarding telemetry blob symmetrically across every broker outcome (success, failure, cancel), closing the failure-path gap Veena flagged on #3111 and unblocking the broker recorder-lifecycle work.

What this adds:

Failure path (was the original A3 scope)

  1. BaseException.onboardingBlob field with getter/setter (common4j).
  2. MsalBrokerResultAdapter.bundleFromBaseException now serializes exception.onboardingBlob into the result bundle (symmetric with the existing ClientDataInfo serialization right above it).
  3. MsalBrokerResultAdapter.getBaseExceptionFromBundle extracts the blob from the deserialized BrokerResult and attaches it to the reconstructed exception via setOnboardingBlob.

Success path (added in second commit)

  1. MSAL-only overloads on MsalBrokerResultAdapter:

    • bundleFromAuthenticationResult(result, onboardingBlob, version)
    • buildBrokerResultFromAuthenticationResult(result, onboardingBlob, version)

    The broker calls these from AccountChooserActivity.returnSuccessToCallingActivity (upcoming PR) to ship the finalized recorder blob to the client. Existing overloads are preserved and delegate to the new ones with null, so no behavior change for existing callers (including AdalBrokerResultAdapter which doesn't need this).

After this, OneAuth / Common can emit onboarding telemetry on the brokered success, failure, and cancel outcomes via:

Why now: Required by upcoming broker recorder-lifecycle work in PR #163 follow-ups, which writes the recorder blob on every termination path.

Tests: MsalBrokerResultAdapterTests adds 4 new round-trip tests (2 failure-path, 2 success-path). All 6 testOnboardingBlob_* tests pass locally:
./gradlew :common:testLocalDebugUnitTest --tests *MsalBrokerResultAdapterTests*testOnboardingBlob*

Safety: Telemetry-only; never affects auth logic. No flight gate (blob is only present if a prior PR seeded it).

Fixes AB#3462876

Copilot AI review requested due to automatic review settings May 18, 2026 17:14
@wzhipan wzhipan requested review from a team as code owners May 18, 2026 17:14
@github-actions

Copy link
Copy Markdown

✅ Work item link check complete. Description contains link AB#3462876 to an Azure Boards work item.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends the onboarding telemetry feature so the broker-populated onboarding blob is preserved not only on success (AcquireTokenResult) but also when brokered flows fail/cancel by carrying the blob on BaseException and round-tripping it through the broker result bundle.

Changes:

  • Add BaseException.onboardingBlob (nullable) with accessor methods to carry the serialized onboarding telemetry blob on failure paths.
  • Update MsalBrokerResultAdapter to serialize exception.onboardingBlob into BrokerResult and restore it back onto the reconstructed BaseException.
  • Add unit tests validating blob round-trip behavior and null behavior parity; update changelog.txt with a MINOR entry.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
common4j/src/main/com/microsoft/identity/common/java/exception/BaseException.java Adds onboardingBlob field + getter/setter to carry onboarding telemetry through exception-based failure paths.
common/src/main/java/com/microsoft/identity/common/internal/result/MsalBrokerResultAdapter.java Serializes/deserializes onboarding blob for exceptions via BrokerResult to preserve it across IPC on failure/cancel outcomes.
common/src/test/java/com/microsoft/identity/common/internal/request/MsalBrokerResultAdapterTests.kt Adds tests ensuring onboarding blob round-trips through exception→bundle→exception and stays null when unset.
changelog.txt Records the change as a MINOR feature addition for vNext.

@wzhipan wzhipan changed the title Propagate onboarding telemetry blob through broker failure path, Fixes AB#3462876 Propagate onboarding telemetry blob through broker success and failure paths, Fixes AB#3462876 May 18, 2026
@github-actions

Copy link
Copy Markdown

✅ Work item link check complete. Description contains link AB#3462876 to an Azure Boards work item.

@Prvnkmr337

Copy link
Copy Markdown
Contributor

Overall change LGTM, ensure the build and tests are passing. Ensure on oneAuth side when reading blob check for Null or empty condition before operating on it.

…metry-failure-extract

# Conflicts:
#	changelog.txt
@wzhipan

wzhipan commented May 21, 2026

Copy link
Copy Markdown
Contributor Author

Rebased onto latest dev and resolved changelog conflicts. Please re-review when you get a chance.

@Prvnkmr337 Prvnkmr337 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the coverage check failure, seems like false positive.

…test + corrupted Robolectric JAR cache + equal-coverage compare bug)
@wzhipan wzhipan merged commit 8638b3b into dev May 22, 2026
27 of 28 checks passed
@wzhipan wzhipan deleted the zhipan/onboarding-telemetry-failure-extract branch May 22, 2026 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants